Use a function for multiple events in JavaScript